using System.Collections.Generic;
using UnityEngine;

public class ShopTabButton : MonoBehaviour
{
	public StoreItemsConfig.StoreItem.ItemType type;

	private Color activeTabColour = new Color(0.74f, 0.74f, 0.74f, 1f);

	private Color disabledTabColour = new Color(0.56f, 0.56f, 0.56f, 1f);

	private UIButton _button;

	public ShopControlLayer shopLayer;

	private UIButton button
	{
		get
		{
			if (_button == null)
			{
				_button = GetComponent<UIButton>();
			}
			return _button;
		}
	}

	public void InitialiseTab(bool isActiveTab)
	{
		if (isActiveTab)
		{
			ActivateTab();
		}
		else
		{
			DeactivateTab();
		}
	}

	public void ActivateTab()
	{
		button.defaultColor = activeTabColour;
		button.UpdateColor(true, true);
	}

	public void DeactivateTab()
	{
		button.defaultColor = disabledTabColour;
		button.UpdateColor(true, true);
	}

	public List<StoreItemsConfig.StoreItem> GetTabItems()
	{
		return StoreItemsConfig.instance.GetItemsForType(type, false);
	}
}
